NAVIÉ

FXVolume

FXVolume

Volumes in Effex are signed distance fields (SDF). This means that in each cell of the internal grid a (signed) distance to the nearest surface position is stored.
Negative distances are always inside of the volume, positive distances outside and 0.0 on the surface

void GetBounds (vector3d& ref_minimum, vector3d& ref_maximum)


Returns
none

Parameters
vector3d& ref_minimum:
filled with the bottom-front-left corner position of the grid channel bounds.

vector3d& ref_minimum:
filled with the top-back-right corner position of the grid channel bounds.

bool Inside (const vector3d& physical_position)


Checks if a position is inside the volume's bounding box

Returns
true if the passed position is inside

Parameters
const vector3d& physical_position:
The physical position to check if it's inside

bool InsideVolume (const vector3d& physical_position, float offset = 0.0f)


Checks if a position is inside the volume.

Returns
true if the passed position is inside the volume.

Parameters
const vector3d& physical_position:
The physical position to check if it's inside

float offset:
A virtual offset/displacement of the surface

void UpdateBounds (void)


Whenever you change data or add data to a volume you should update its bounds afterward. You should never call this in a multiprocessor context.

double GetDistance (const vector3d& physical_position)


Returns
the interpolated distance value in the volume at the given position

Parameters
const vector3d& physical_position:
The physical position to get the distance for

double GetMaxDistance (void)


Returns
the maximum signed distance available inside the volume

float GetDensity (void)


Returns
the density of the volume (only available if the volume is a rigid body)

float GetInvMass (void)


Returns
the inverse mass of the volume (only available if the volume is a rigid body)

vector3d GetInvTensor (void)


Returns
the inverse tensor of the volume (only available if the volume is a rigid body)

bool IsObstacle (void)


Returns
true if the volume is an obstacle

bool IsGridObstacle (void)


Returns
true if the volume is a grid obstacle. This is used by the framework and not by rigid bodies.

bool IsDynamicBody (void)


Returns
true if this is a dynamic rigid body.

bool IsKinematicBody (void)


Returns
true if this is a kinematic body. This means the user has animated (keyframed) the volume source mesh.

bool IsStaticBody (void)


Returns
true if this is a non-moving static rigid body.

vector3d GetNormal (const vector3d& physical_position)


Retrieve a normal of the volume at the given position. This works at any position inside the volume's bounding box and may either point into the volume (if the position is outside) or out of the volume (if the position is inside)

Returns
the normal vector

Parameters
const vector3d& physical_position:
The physical position to get the normal for

double LinearFalloff (const vector3d& physical_position)


Generates a linear falloff value between 0.0 and 1.0. This is only valid inside the volume!

Returns
the linear falloff value

Parameters
const vector3d& physical_position:
The physical position to determine the falloff value for.

bool ProjectPoint (vector3d &global_physical_position, vector3d &result_grid_position, vector3d& result_coll_normal, double projection = 0.001)


This projects (moves) the given position to the surface of the volume. This is only valid for positions inside the volume

Returns
true if the passed position was inside and was successfully projected.

Parameters
const vector3d& global_physical_position:
The physical position to project

vector3d &result_grid_position:
Filled with the projected position

vector3d &result_grid_position:
Filled with the collision normal

double projection:
A displacement for the projected position. Higher values result in the projected position being displaced further to the outside.